 subroutine getamesp_int(icore, nfirst, nread, lth, filename)
 implicit none 
 integer,intent(in):: lth, nfirst, nread 
 real*8, intent(inout)::icore(*) 
 character(len=8), intent(in) :: filename
!
 integer ioffa, idx, i
 OPEN(1666, FILE=filename, ACCESS='DIRECT', FORM='UNFORMATTED', RECL=8*lth)
 ioffa = 0 
 do idx = nfirst, nfirst+nread-1
    read(1666, rec=idx) (icore(ioffa+i), i=1, lth)
    ioffa = ioffa + lth
 enddo
 close(1666)
 return 
 end
 
